package com.knife.file.infra.constants;

import java.io.File;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： 76875
 * @date： 2022/4/6 星期三 16:35
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
public class FileConstant {
    public static final String DIRECTORY_SEPARATOR = "/";
    public static final String DEFAULT_MULTI_TYPE = "application/octet-stream";
    public static final String DOMAIN_BUCKET_NAME = "{bucketName}";

    public static final class Protocol {
        public static final String HTTP = "http";
        public static final String HTTPS = "https";

    }

    public static final class MicrosoftControl {
        public static final String OFF = "off";
        public static final String CONTAINER = "container";
        public static final String BLOB = "blob";

    }

    public static final class BaiduAccessControl {
        public static final String PRIVATE = "private";
        public static final String PUBLIC_READ = "public-read";
        public static final String PUBLIC_READ_WRITE = "public-read-write";

    }

    public static final class AwsAccessControl {
        public static final String PRIVATE = "private";
        public static final String PUBLIC_READ = "public-read";
        public static final String PUBLIC_READ_WRITE = "public-read-write";

    }

    public static final class LocalAccessController {
        public static final String PUBLIC_READ_WRITE = "public-read-write";

    }

    public static final class QcloudAccessControl {
        public static final String DEFAULT = "default";
        public static final String PRIVATE = "private";
        public static final String PUBLIC_READ = "public-read";
        public static final String PUBLIC_READ_WRITE = "public-read-write";

    }

    public static final class HuaweiAccessControl {
        public static final String PRIVATE = "private";
        public static final String PUBLIC_READ = "public-read";
        public static final String PUBLIC_READ_WRITE = "public-read-write";

    }

    public static final class AliyunAccessControl {
        public static final String DEFAULT = "default";
        public static final String PRIVATE = "private";
        public static final String PUBLIC_READ = "public-read";
        public static final String PUBLIC_READ_WRITE = "public-read-write";

    }

    public static final class MinioAccessControl {
        public static final String NONE = "none";
        public static final String READ_ONLY = "read-only";
        public static final String WRITE_ONLY = "write-only";
        public static final String READ_WRITE = "read-write";

    }

    public static class KnifeFileConstant {
        private KnifeFileConstant() {
        }

        public static final String ROOT = System.getProperty("user.dir") + File.separator + "file";
        public static final String TEMP = "temp";
        public static final String REAL = "real";

        /**
         * 默认附件UUID
         */
        public static final String DEFAULT_ATTACHMENT_UUID = "$";
        /**
         * 默认字符集
         */
        public static final String DEFAULT_CHARACTER_SET = "UTF-8";
        /**
         * 默认拼接符号
         */
        public static final String DEFAULT_SPLIT_SYMBOL = "@";
        /**
         * 默认Multi上传文件类型
         */
        public static final String DEFAULT_MULTI_TYPE = "application/octet-stream";
        /**
         * 默认文件分隔符
         */
        public static final String DIRECTORY_SEPARATOR = "/";
        /**
         * 上传目录禁止出现的字符
         */
        private static final String[] FORBIDDEN_SYMBOLS = {"\\", ":", "*", "?", "\"", "<", ">", "|"};

        /**
         * KB/MB 进率
         */
        public static final Integer ENTERING = 1024;

        /**
         * 匹配小写中划线的正则
         */
        public static final String LOW_STRIKE = "^[a-z0-9-]*$";

        /**
         * 数字
         */
        public static final class Digital {
            private Digital() {
            }

            public static final Integer SIX = 6;
            public static final Integer FOUR_HUNDRED_AND_EIGHTY = 480;

        }

        /**
         * 存储单位
         */
        public static final class StorageUnit {
            private StorageUnit() {
            }

            public static final String KB = "KB";
            public static final String MB = "MB";
        }

        /**
         * 文件类型
         */
        public static final class ContentType {
            private ContentType() {
            }

            public static final String APPLICATION = "application";
            public static final String AUDIO = "audio";
            public static final String VIDEO = "video";
            public static final String IMAGE = "image";
            public static final String TEXT = "text";
        }

        public static final class PreviewFileType {
            private PreviewFileType() {
            }

            /**
             * 图片
             */
            public static final String IMAGE = "image";
            /**
             * PDF
             */
            public static final String PDF = "pdf";
        }

        /**
         * 文件名前缀策略
         */
        public static final class PrefixStrategy {

            private PrefixStrategy() {
            }

            /**
             * uuid
             */
            public static final String UUID = "uuid";
            /**
             * 目录
             */
            public static final String FOLDER = "folder";
            /**
             * 不使用前缀
             */
            public static final String NONE = "none";
        }

        /**
         * 服务器上传类型
         */
        public static final class SourceType {
            private SourceType() {
            }

            public static final String SERVER = "S";
            public static final String CLUSTER = "C";
        }
    }
}
